import request from '@/utils/request'

export function createOrder(data) {
  return request({
    url: '/orders',
    method: 'post',
    data
  })
}

export function pay(data) {
  return request({
    url: '/orders/payment',
    method: 'post',
    data
  })
}

export function successPayment(data) {
  return request({
    url: '/orders/successPayment',
    method: 'post',
    data
  })
}

export function getOrderInfo(query) {
  return request({
    url: '/orders',
    method: 'get',
    params: query
  })
}

export function getOrderDetail(order_number) {
  return request({
    url: `/orders/orderDetail/${order_number}`,
    method: 'get'
  })
}

export function updateOrderStatus(id, data) {
  return request({
    url: `/orders/${id}`,
    method: 'patch',
    data
  })
}

export function remove(id) {
  return request({
    url: `/orders/${id}/remove`,
    method: 'delete'
  })
}

export function getkuaidi(order_number) {
  return request({
    url: '/orders/kuaidi',
    method: 'get',
    params: order_number
  })
}